# VRJ.NET is (C) Copyright 2004-2007 by Patrick Hartling
# Distributed under the GNU Lesser General Public License 2.1.  (See
# accompanying file COPYING.txt or http://www.gnu.org/copyleft/lesser.txt)

default: debug

exec_prefix=	@exec_prefix@
datadir=	@datadir@
prefix=		@prefix@
projdatadir=	$(datadir)/vrjnet
scriptdir=	$(top_srcdir)/release/scripts
topdir=		@topdir@
top_srcdir=	@top_srcdir@

EXEC_PERMS=	@EXEC_PERMS@
MAKEFLAGS+=	--no-print-directory
PERL=		@PERL@

SUBDIR=		vrjnet_util	\
		src

@SET_MAKE@

# TODO: Come up with a new way to do recursive builds, possibly through the
# use of some GNU make fanciness.  Doozer++ needs a better way of doing
# recursion.
recursive:
	@for dir in $(SUBDIR) ; do			\
           echo "===> $$dir" ;				\
           $(MAKE) -C $$dir $(RECTARGET) || exit 1;	\
           echo "<=== $$dir" ;				\
         done

all debug optim:
	$(MAKE) RECTARGET="$@" recursive

# XXX: The chmod thing at the end is pretty lame.
install:
	$(MAKE) RECTARGET="$@" recursive
	$(scriptdir)/mkinstalldirs $(projdatadir)/examples
	$(PERL) $(scriptdir)/install-dir.pl -o $(projdatadir)/examples	\
          -i $(top_srcdir)/examples -v "$(topdir)/VARS.pl"

clean cleandepend:
	$(MAKE) RECTARGET="$@" recursive

clobber:
	$(MAKE) RECTARGET="$@" recursive
	rm -rf lib
